home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_12_03
/
allison
/
trace2.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-01-05
|
390b
|
26 lines
LISTING 4 - Illustrates the Token-pasting Operator
/* trace2.c: Illustrate a trace macro for debugging */
#include <stdio.h>
#define trace(x,format) \
printf(#x " = %" #format "\n",x)
#define trace2(i) trace(x ## i,d)
main()
{
int x1 = 1, x2 = 2, x3 = 3;
trace2(1);
trace2(2);
trace2(3);
return 0;
}
/* Output:
x1 = 1
x2 = 2
x3 = 3
*/